<template>
	<view>
		<view class="p-3 mt-3 bg-white ">
			<input type="text" value="" placeholder="请输入用户名" v-model="User.username"  @input="inputKeep" />
		</view>
		<view class="mx-3 mt-5">
			<button type="warn" @click="keep">保存</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				User:uni.getStorageSync("user"),
				userName:""
			}
		},
		methods: {
			// 用户名更新 
			keep(){
				this.$H.post("admin/user/update",{
					username:this.userName,
					}).then(res=>{
					console.log(res)
					uni.navigateBack({
						delta:1
					})
				})
			},
			// 监听输入框的内容
			inputKeep(e){
				this.userName=e.detail.value
			}
		},
		onLoad() {
		}
	}
</script>

<style>

</style>
